import request from '@/utils/request'

// 获取竞赛列表
export function getExamListApi(params) {
    return request({
        method: 'get',
        url: 'exam/list',
        params
    })
}

// 添加竞赛
export function addExamApi(data) {
    return request({
        method: "post",
        url: 'exam/add',
        data:data
    })
}

// 添加竞赛题目
export function addExamQuestionApi(data) {
    return request({
        method: 'post',
        url: 'exam/question/add',
        data:data
    })
}
// 获取竞赛详情
export function getExamDetailApi(examId) {
    return request({
        method: 'get',
        url: 'exam/detail',
        params:{examId}
    })
}

// 编辑竞赛基本信息
export function editExamApi(data) {
    return request({
        method: 'put',
        url: 'exam/edit',
        data:data
    })
}

// 删除竞赛中的题目
export function delExamQuestionApi(examId, questionId) {
    return request({
        method: 'delete',
        url: 'exam/question/del',
        params:{examId,questionId}
    })
}


// 删除竞赛
export function delExamApi(examId) {
    return request({
        method: 'delete',
        url: 'exam/del',
        params:{examId}
    })
}

// 发布竞赛
export function publishExamApi(examId) {
    return request({
        method: 'put',
        url: 'exam/publish',
        params:{examId}
    })
}

// 撤销发布竞赛
export function unpublishExamApi(examId) {
    return request({
        method: 'put',
        url: 'exam/unpublish',
        params:{examId}
    })
}


// 修改竞赛题目顺序
export function editExamQuestionSortApi(data) {
    return request({
        method: 'put',
        url: 'exam/question/update/order',
        data:data
    })  
}